package com.wjh.goods.request;

import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.DecimalMin;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

/**
 * 保存商品信息 请求参数
 * 
 * @author wenjianhai
 * @date 2023/6/21
 * @since JDK 17
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ToString(callSuper = true)
public class SaveGoodsRequest implements Serializable {
	@Serial
	private static final long serialVersionUID = 3346620325857469301L;

	/** 主键id（新增时为空，修改时不为空） */
	@Schema(description = "主键id（新增时为空，修改时不为空）")
	private Long id;

	/** 商品名称 */
	@Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED)
	@NotBlank(message = "商品名称不能为空")
	private String goodsName;

	/** 单价（单位：元） */
	@Schema(description = "单价（单位：元）", requiredMode = Schema.RequiredMode.REQUIRED)
	@NotNull(message = "单价不能为空")
	@DecimalMin(value = "0.01", message = "单价不能小于0.01")
	private BigDecimal price;

	/** 售价（单位：元） */
	@Schema(description = "售价（单位：元）", requiredMode = Schema.RequiredMode.REQUIRED)
	@NotNull(message = "售价不能为空")
	@DecimalMin(value = "0.01", message = "售价不能小于0.01")
	private BigDecimal sellPrice;

	/** 库存 */
	@Schema(description = "库存", requiredMode = Schema.RequiredMode.REQUIRED)
	@NotNull(message = "库存不能为空")
	@Min(value = 1, message = "库存不能小于1")
	@Max(value = 99999999, message = "库存不能大于99999999")
	private Integer stock;
}
